﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace qkview
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapRoute(
                name: "Root",
                url: "",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );

            routes.MapRoute(
              name: "AdminUser",
              url: "AdminUser/{action}/{id}",
              defaults: new { controller = "AdminUser", action = "Index", id = UrlParameter.Optional }              
          );


            routes.MapRoute(
               name: "Account",
               url: "Account/{action}/{id}",
               defaults: new { controller = "Account", action = "Index", id = UrlParameter.Optional }
           );

            routes.MapRoute(
             name: "BoardMain",
             url: "Board/{action}/{id}",
             defaults: new { controller = "Board", action = "Index", id = UrlParameter.Optional }
         );

            routes.MapRoute(
              name: "Page",
              url: "Page/{action}/{id}",
              defaults: new { controller = "Page", action = "Index", id = UrlParameter.Optional }
          );

            routes.MapRoute(
                name: "Board",
                url: "{username}",
                defaults: new { controller = "Board", action = "Index", username = "" }
            );

            routes.MapRoute(
               name: "Note",
               url: "{username}/{boardurl}",
               defaults: new { controller = "Note", action = "Index", username = "", boardurl = "" }
            );

            routes.MapRoute(
             name: "Section",
             url: "{username}/{boardurl}/{sectionurl}",
             defaults: new { controller = "Note", action = "Section", username = "", boardurl = "", sectionurl="" }
          );


            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}